import logging
import requests


class IhrmAddApi:
    @classmethod
    def add(cls, param_head, param_body):
        # 准备请求数据的行头体
        req_url = 'http://ihrm-test.itheima.net/api/sys/user'
        req_head = param_head
        req_body = param_body

        # 发送请求，获取响应结果
        res = requests.post(url=req_url, headers=req_head, json=req_body)

        # 响应体数据的日志收集
        logging.info('添加员工接口返回的响应体的数据:{}'.format(res.json()))

        # 返回响应结果
        return res
